"""
Filename: try-logger.py 
Created on Tue Sep  1 18:43:39 CST 2020

@author: Kefeng Zhu (zhukefeng@inspur.com, zkf1985@gmail.com, zkf85@163.com)

Description:
    Try Python Built-in Logging Module
"""
import logging
import os
#logging.basicConfig(filename='logger.log', level=logging.INFO, 
#        #format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
#        format='%(asctime)s - %(message)s')

logger = logging.getLogger('kefeng')
#logger.setLevel(level=logging.INFO)
logger.setLevel(level=logging.DEBUG)
handler = logging.FileHandler(os.path.join('/home/zhukf/BadmintonOrdering','log.txt'))
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
logger.addHandler(handler)

console = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
console.setFormatter(formatter)
logger.addHandler(console)

logger.debug('debug message')
logger.info('info message')
logger.warning('warn message')
logger.error('error message')
logger.critical('critical message') 
